 //
//  IncomeViewController.m
//  shopping
//
//  Created by 马田成 on 2017/8/30.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "IncomeViewController.h"
#import "shouYierWeiMaViewController.h"

@interface IncomeViewController ()<UIWebViewDelegate>
{



    UIWebView *myWebView;
}

@end

@implementation IncomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self leftNavHide];
    
    UIButton *buttonAdd = [[UIButton alloc] init];
    
    buttonAdd.frame = CGRectMake(DEF_SCREEN_WIDTH - 50, 0, 40, 40);
    
    
    [buttonAdd setTitle:@"邀请" forState:UIControlStateNormal];
    [buttonAdd setTitleColor:getColor(@"222222") forState:UIControlStateNormal];
    [buttonAdd addTarget:self action:@selector(messageClick) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *rightItme = [[UIBarButtonItem alloc]initWithCustomView:buttonAdd];
    self.navigationItem.rightBarButtonItem = rightItme;
    myWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, scrWidth(), scrHeight() - 49- 64)];
    //    myWebView.delegate = self;
    [self.view addSubview:myWebView];
    myWebView.delegate = self;
    myWebView.backgroundColor = [UIColor whiteColor];
    NSString *basePath = [[NSBundle mainBundle]bundlePath];
    NSString *helpHtmlPath = [basePath stringByAppendingPathComponent:@"shouyi.html"];
    NSURL *url = [NSURL fileURLWithPath:helpHtmlPath];
    //加载本地html文件
    [myWebView loadRequest:[NSURLRequest requestWithURL:url]];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView{
    
    NSString *jsStr = [NSString stringWithFormat:@"window.test.initData('%@')",[PublicFunction getConfigWithKey:@"token"]];
    [myWebView stringByEvaluatingJavaScriptFromString:jsStr];
    

    
}

- (void)messageClick{

    
    shouYierWeiMaViewController *vc= [[shouYierWeiMaViewController alloc] init];
    
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
    
    
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
